#!/bin/sh

get_date() {
    echo `exif -t'Date and Time' $1 | grep Value | awk '{print$2}' | tr ':' '-'`
}

for f in *.jpg; do
    d=`get_date $f`
    [ -d $d ] || mkdir $d
    mv $f $d
done
